home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / sources.arc / DANG_SRC.LZH / SPECIAL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-19  |  4.7 KB  |  183 lines

  1. #include <globals2.h>
  2.  
  3. char hammr[] = "2 hammr";
  4. char gate_[] = "2 gate0";
  5.  
  6. /* this module will check for special events, eg
  7.    if you are at room 164 and user.user_items[14] is true
  8.    Eg you have the key to get into the gate! 
  9.    will also set :
  10.  
  11.                   map[13][1].e = 164    was = 0 now = room 164
  12.                                         so you can walk past gate.
  13.                   map[13][2].w = 163    was = 0, .....
  14.  
  15.  
  16. Also checks to see if you are in front of a smithy and plays 
  17. the hammer sample..
  18.  
  19. */
  20.           
  21.  
  22. special_events(mfs,mfd,pxyarray,scr3)
  23. register MFDB *mfs,*mfd;   /* the src and dest MFDBs!! */
  24. char *scr3;  /* addr of gate.dat */
  25. int pxyarray[8];
  26.  
  27. {
  28.  int f;
  29.  static int been_in_here = 0;   
  30.  static int hammer = 0;
  31.  
  32.  if( ((cell == 164 && dir == 'W') || (cell == 163 && dir =='E')) 
  33.      && (user.user_items[14] == 1 && been_in_here == 0)) 
  34.       /* if in room 164 and facing west, or room 163 and facing east
  35.          AND you have the KEY to get in!!...and you have never 
  36.          seen the gate openn.. */
  37.    {
  38.  
  39.       been_in_here = 1;  /* say you've been in here, so once
  40.                             if opens, you'll never see it open again */
  41.  
  42.       mfs->fd_addr = (long) scr3; /* copy address */
  43.    
  44.       pxyarray[0] = 70;  /* the movement of the gate will be*/
  45.       pxyarray[1] = 3;  /* top left,top right.bl,br */
  46.       pxyarray[2] = 192;
  47.       pxyarray[3] = 91; 
  48.  Vsync();
  49.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */
  50.        invoke_tsr( gate_ );      /*play */
  51.  
  52.     
  53.    
  54.  
  55.       pxyarray[0] = 194;  /* the movement of the gate will be*/
  56.       pxyarray[1] = 3;  /* top left,top right.bl,br */
  57.       pxyarray[2] = 316;
  58.       pxyarray[3] = 91; 
  59. Vsync();       
  60.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */
  61.         invoke_tsr( gate_ );      /*play */
  62.  
  63.     
  64.  
  65.       pxyarray[0] = 70;  /* the movement of the gate will be*/
  66.       pxyarray[1] = 93;  /* top left,top right.bl,br */
  67.       pxyarray[2] = 192;
  68.       pxyarray[3] = 181;
  69.        Vsync();
  70.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */    
  71.         invoke_tsr( gate_ );      /*play */
  72.  
  73.        
  74.  
  75.       pxyarray[0] = 194;  /* the movement of the gate will be*/
  76.       pxyarray[1] = 93;  /* top left,top right.bl,br */
  77.       pxyarray[2] = 316;
  78.       pxyarray[3] = 181; 
  79.        Vsync();
  80.        vro_cpyfm(handle,3,pxyarray,mfs,mfd);  /* copy */   
  81.         invoke_tsr( gate_ );      /*play */
  82.  
  83.       
  84.  
  85.  
  86. map[13][1].e = 164;   /*update map array to say you can now pass
  87.                         through gate */
  88.                                         
  89. map[13][2].w = 163;
  90.  
  91.  
  92.  
  93.    }  /* end of GATE if */
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  if(cell == 47 || cell == 227 || cell == 221 || cell == 46 ||
  100.       cell == 228 || cell == 234)
  101. {
  102.  if(hammer == 0)
  103.  invoke_tsr( hammr );      /*play */
  104.         if(CURRENT_SOUND == 1) Dosound( wind_sound );
  105.         if(CURRENT_SOUND == 4) Dosound( rain_sound );
  106.  
  107.   hammer++; if(hammer == 12) hammer = 0;   /* every 4th time you're 
  108.                                              near a smithy, you'll
  109.                                              hear this */
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116. }
  117.  
  118.  
  119. /*****/
  120. short_wait()
  121. {
  122.  int oo,ppq;
  123.  
  124.   for(oo=9;oo<500;oo++)
  125.    for(ppq=0;ppq<190;ppq++)
  126.     ;
  127. }
  128.  
  129. /*********************************/
  130. /** This will load up an inside estab pic.
  131.     o typeofpic. if 1 use reg inside pic, else use smithy pic
  132.   
  133.     o It will load up pic 'estab.dat' which is pic28
  134.     o It will change and SAVE cells 10,11 & 14 of newpal[]
  135.       and return them in the vars   COL1,COL2,COL3
  136. **/
  137.  
  138.  
  139. load_up_inside_pics(mf_src,mf_dest,pxyarray,scr2,typeofpic)
  140. register MFDB *mf_src,*mf_dest;   /* the src and dest MFDBs!! */
  141. char *scr2;
  142. int pxyarray[8],typeofpic;
  143. /* typeof pic. if 1 use regular inside pic.
  144.                if 2 use guild pic.   Bottom left template
  145.                if 0 use smithy pic */
  146.  
  147. {
  148.  int f;
  149.            mf_src->fd_addr = (long) scr2; /* copy address */
  150.    
  151.            
  152.        /* change these colors.. */
  153.       Setcolor(10,0x430); Setcolor(11,0x432); Setcolor(14,0x320);
  154.    if( typeofpic==1)
  155.      {
  156.       pxyarray[0] = 70;       /* coords for reg estab inside */
  157.       pxyarray[1] = 3;  
  158.       pxyarray[2] = 192;
  159.       pxyarray[3] = 91; 
  160.      }
  161.     if(typeofpic == 2)
  162.     {
  163.       pxyarray[0] = 70;       /* coords for guild */
  164.       pxyarray[1] = 93;  
  165.       pxyarray[2] = 192;
  166.       pxyarray[3] = 181;
  167.     }
  168.     if(typeofpic == 0) 
  169.       {
  170.       pxyarray[0] = 194;    /* coords for smithy... */
  171.       pxyarray[1] = 93;  
  172.       pxyarray[2] = 316;
  173.       pxyarray[3] = 181; 
  174.       }
  175.  Vsync();
  176.        vro_cpyfm(handle,3,pxyarray,mf_src,mf_dest);
  177.       
  178.    }  /* end ofmodule load up estab.pic! */
  179.  
  180.  
  181. /****/
  182.